package 线程池的使用.emun;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;


/**
 * @author baizhenyu
 */

@Getter
@AllArgsConstructor
public enum PurposeChannelEnum {

    /**
     * 精准营销
     */
    ACCURATE("ACCURATE", "精准营销"),

    /**
     * 精准营销-商城券
     */
    ACCURATE_MALL("ACCURATE_MALL", "精准营销-商城券"),

    /**
     * 精准营销-代金券
     */
    ACCURATE_VOU("ACCURATE_VOU", "精准营销-代金券"),

    /**
     * 指定发券-商城券
     */
    BATCH_MALL("BATCH_MALL", "指定发券-商城券"),

    /**
     * 指定发券-代金券
     */
    BATCH("BATCH", "指定发券"),

    /**
     * 会员发券-商城券
     */
    MEMBER_MALL("MEMBER_MALL", "会员发券-商城券"),

    /**
     * 会员发券-代金券
     */
    MEMBER("MEMBER", "会员发券");

    @Getter
    private String code;

    @Getter
    private String desc;

    /**
     * 判断是否存在code
     *
     * @param code 键
     * @return 值
     */
    public static Boolean existCode(String code) {
        if (StringUtils.isEmpty(code)) {
            return false;
        }
        for (PurposeChannelEnum element : PurposeChannelEnum.values()) {
            if (element.getCode().equals(code)) {
                return true;
            }
        }
        return false;
    }
}